package com.zh.baselibrary.api;

import com.zh.baselibrary.netutils.BaseResp;
import com.zh.model.Errata;
import com.zh.model.ResAdsParItem;
import com.zh.model.manager.BookInfo;
import com.zh.model.manager.SearchBook;
import com.zh.model.request.ErrorInfo;
import com.zh.model.request.SubmitInfo;
import com.zh.model.task.home.ReportVersionBean;

import java.util.List;
import java.util.Set;

import io.reactivex.Observable;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;

/**
 * @author EnzoChan
 * @create 2019/4/8
 * @desc:
 */
public interface IBookBusiness {
    /**
     * 图书查询接口
     *
     * @return
     */
    @GET("/irc/{schoolId}/book/findAll")
    Observable<BaseResp<SearchBook>> queryBook(@Path("schoolId") String schoolId,
                                               @Query("name") String name,
                                               @Query("equipmentCode") String equipmentCode,
                                               @Query("pageNum") int pageNum,
                                               @Query("pageSize") int pageSize);


    /**
     * 查询该图书柜上的图书信息接口（选书）
     *
     * @param equipmentCode
     * @param name
     * @return
     */
    @GET("/irc/{schoolId}/book/search")
    Observable<BaseResp<List<BookInfo>>> selectBook(@Path("schoolId") String schoolId,
                                              @Query("equipmentCode") String equipmentCode,
                                              @Query("name") String name);

    /**
     * 进入搜索页面书籍界面日志记录
     * @return
     */
    @GET("/irc/{schoolId}/searchpage")
    Observable<BaseResp<Object>> selectCount(@Path("schoolId") String schoolId);
    /**
     * 异常处理接口（未关门情况下进行）
     *
     * @param schoolId
     * @param info
     * @return
     */
    @POST("/irc/{schoolId}/book/error")
    Observable<BaseResp<Object>> error(@Path("schoolId") String schoolId, @Body ErrorInfo info);


    /**
     * 上下架、借还书 完成
     *
     * @param schoolId
     * @param info
     * @return
     */
    @POST("/irc/{schoolId}/book/operate")
    Observable<BaseResp<Object>> operate(@Path("schoolId") String schoolId,
                                 @Body SubmitInfo info);


    /**
     * 根据射频卡标签获取图书状态
     *
     * @param schoolId
     * @param list
     * @return
     */
    @POST("/irc/{schoolId}/book/status")
    Observable<BaseResp<List<BookInfo>>> status(@Path("schoolId") String schoolId,
                                             @Body List<String> list);


    /**
     * 获取借阅记录
     *
     * @return
     */
    @GET("/irc/{schoolId}/book/borrowRecord")
    Observable<BaseResp<List<BookInfo>>> borrowRecord(@Path("schoolId") String schoolId);


    /**
     * 获取轮播图
     *
     * @param schoolId
     * @param equipmentCode
     * @return
     */
    @GET("/irc/{schoolId}/getBarner")
    Observable<BaseResp<List<ResAdsParItem>>> getBarner(@Path("schoolId") String schoolId,
                                                  @Query("equipmentCode") String equipmentCode);


    /**
     * 上报设备版本号
     *
     * @param equipmentCode
     * @param versionBean
     * @return
     */
    @POST("/irc/equipment/{equipmentCode}/reportversion")
    Observable<BaseResp<Object>> reportVersion(@Path("equipmentCode") String equipmentCode, @Body ReportVersionBean versionBean, @Header("token") String token);

    /**
     * 勘误开柜

     */
    @POST("/irc/open/errata")
    Observable<BaseResp<Object>> errata(@Body Errata errata);

    /**
     * 上报设备版本号
     *
     * @param equipmentCode
     * @param versionBean
     * @return
     */
    @POST("/irc/equipment/{equipmentCode}/reportversion")
    Observable<BaseResp<Object>> reportVersion(@Path("equipmentCode") String equipmentCode, @Body ReportVersionBean versionBean);
}
